home *** CD-ROM | disk | FTP | other *** search
/ PC User 2003 July / Disc 1 / PCU0703CD1.iso / software / online / files / imacros.exe / COMBINE-MACROS.VBS < prev    next >
Encoding:
Text File  |  2002-10-05  |  2.1 KB  |  61 lines

  1. '*****
  2. 'This part is for the script specific error log (instead of popup messages).
  3. 'The advantage of an error log instead of a popup is that the script 
  4. 'continues running even after an error appears. An example of an error would
  5. 'be a timeout due to a temporarily slow web site. 
  6.  
  7.  
  8. Dim objFileSystem, objOutputFile
  9. Dim strOutputFile
  10.  
  11. Const OPEN_FILE_FOR_APPENDING = 8
  12. ' generate a logfile name based on the script name
  13. strOutputFile = "./combine-macros-errorlog.txt" 
  14. Set objFileSystem = CreateObject("Scripting.fileSystemObject")
  15. Set objOutputFile = objFileSystem.CreateTextFile(strOutputFile, TRUE)
  16. objOutputFile.WriteLine("Error Log for COMBINE-MACROS.VBS demo script")
  17.  
  18. '****
  19.  
  20.  
  21. Msgbox ("This example script calls several Internet macros. Each macro performs a specific function on the website (Loading the website with wsh-start, form filling with wsh-lunch and finally submitting the form with wsh-submit)." + vbCrLf + vbCrLf + "The script also demonstrates how to create a SCRIPT SPECIFIC error log file.") 
  22.  
  23. set iim1= CreateObject ("iimwsh.iim")
  24.  
  25. i=  iim1.iimInit
  26. 'If i < 0 Then msgbox iim1.iimGetLastMessage()
  27. if i < 0 then objOutputFile.WriteLine("INIT: Error-No: " + cstr(i) + " => Description: " + iim1.iimGetLastMessage())
  28.  
  29.  
  30. i = iim1.iimPlay("wsh-start")
  31. 'If i < 0 Then msgbox iim1.iimGetLastMessage()
  32. if i < 0 then objOutputFile.WriteLine("WSH-START: Error-No: " + cstr(i) + " => Description: " + iim1.iimGetLastMessage())
  33.  
  34.  
  35. i = iim1.iimPlay("wsh-lunch")
  36. 'If i < 0 Then msgbox iim1.iimGetLastMessage()
  37. if i < 0 then objOutputFile.WriteLine("WSH-LUNCH: Error-No: " + cstr(i) + " => Description: " + iim1.iimGetLastMessage())
  38.  
  39.  
  40. i = iim1.iimPlay("wsh-submit")
  41. 'If i < 0 Then msgbox iim1.iimGetLastMessage()
  42. if i < 0 then objOutputFile.WriteLine("WSH-SUBMIT: Error-No: " + cstr(i) + " => Description: " + iim1.iimGetLastMessage())
  43.  
  44.  
  45. i = iim1.iimExit
  46. if i < 0 then objOutputFile.WriteLine("EXIT: Error-No: " + cstr(i) + " => Description: " + iim1.iimGetLastMessage())
  47.  
  48.  
  49. '*****
  50.  
  51. 'This part is for the script specific error log (instead of popup messages).
  52. objOutputFile.Close
  53. Set objFileSystem = Nothing
  54.  
  55. '*****
  56.  
  57. WScript.Quit(0)
  58.  
  59.  
  60.  
  61.